package com.ht.system.controller;
import java.util.Date;
import java.util.List;
import java.io.IOException;
import com.ht.common.core.web.domain.AjaxResult;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ht.common.log.annotation.Log;
import com.ht.common.security.utils.SecurityUtils;
import com.ht.common.core.utils.SnowflakeIdWorker;
import com.ht.common.log.enums.BusinessType;
import com.ht.common.security.annotation.RequiresPermissions;
import com.ht.system.domain.EnterpriseFieldAuth;
import com.ht.system.service.IEnterpriseFieldAuthService;
import com.ht.common.core.web.controller.BaseController;
import com.ht.common.core.web.domain.AjaxResult;
import com.ht.common.core.utils.poi.ExcelUtil;
import com.ht.common.security.utils.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import com.ht.common.core.web.page.TableDataInfo;

/**
 * 企业场所授权Controller
 * 
 * @author zmx
 * @date 2025-03-23
 */
 @Api(tags = "企业场所授权接口")
@RestController
@RequestMapping("/enterpriseFieldAuth")
public class EnterpriseFieldAuthController extends BaseController
{
    @Autowired
    private IEnterpriseFieldAuthService enterpriseFieldAuthService;

    /**
     * 查询企业场所授权列表
     */
    @ApiOperation("列表,权限:system:enterpriseFieldAuth:list")
    @RequiresPermissions("system:enterpriseFieldAuth:list")
    @GetMapping("/list")
    public TableDataInfo list(EnterpriseFieldAuth enterpriseFieldAuth)
    {
        startPage();
        List<EnterpriseFieldAuth> list = enterpriseFieldAuthService.selectEnterpriseFieldAuthList(enterpriseFieldAuth);
        return getDataTable(list);
    }


    /**
     * 获取企业场所授权详细信息
     */
    @ApiOperation("详细信息,权限:system:enterpriseFieldAuth:list")
    @RequiresPermissions("system:enterpriseFieldAuth:list")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(enterpriseFieldAuthService.selectEnterpriseFieldAuthById(id));
    }

    /**
     * 新增企业场所授权
     */
    @ApiOperation("新增,权限:system:enterpriseFieldAuth:add")
    @RequiresPermissions("system:enterpriseFieldAuth:add")
    @Log(title = "企业场所授权", businessType = BusinessType.INSERT)
    @PostMapping("add")
    public AjaxResult add(@RequestBody EnterpriseFieldAuth enterpriseFieldAuth)
    {
				enterpriseFieldAuth.setId(SnowflakeIdWorker.getUUID());
        return toAjax(enterpriseFieldAuthService.insertEnterpriseFieldAuth(enterpriseFieldAuth));
    }

    /**
     * 修改企业场所授权
     */
    @ApiOperation("修改,权限:system:enterpriseFieldAuth:edit")
    @RequiresPermissions("system:enterpriseFieldAuth:edit")
    @Log(title = "企业场所授权", businessType = BusinessType.UPDATE)
    @PostMapping("edit")
    public AjaxResult edit(@RequestBody EnterpriseFieldAuth enterpriseFieldAuth)
    {
        return toAjax(enterpriseFieldAuthService.updateEnterpriseFieldAuth(enterpriseFieldAuth));
    }
    
    @ApiOperation("授权认证审核,权限:system:enterpriseFieldAuth:edit")
    @RequiresPermissions("system:enterpriseFieldAuth:edit")
    @Log(title = "授权认证审核", businessType = BusinessType.UPDATE)
    @PostMapping("audit")
    public AjaxResult audit(@RequestBody EnterpriseFieldAuth enterpriseFieldAuth)
    {
        return toAjax(enterpriseFieldAuthService.auditEnterpriseFieldAuth(enterpriseFieldAuth));
    }

    /**
     * 删除企业场所授权
     */
    @ApiOperation("删除,权限:system:enterpriseFieldAuth:remove")
    @RequiresPermissions("system:enterpriseFieldAuth:remove")
    @Log(title = "企业场所授权", businessType = BusinessType.DELETE)
	@GetMapping("remove/{ids}")
    public AjaxResult remove(@PathVariable("ids") String[] ids)
    {
        return toAjax(enterpriseFieldAuthService.deleteEnterpriseFieldAuthByIds(ids));
    }
}
